<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>卡帮帮</title>
		<link rel="stylesheet" type="text/css" href="/static/css/NewH5.css"/>
    	<link rel="stylesheet" type="text/css" href="/static/css/iconfont.css"/>
		<script src="/static/js/base.js" type="text/javascript" charset="utf-8"></script>
	    <style type="text/css">
	      .on{display:block;}
	    </style>
	</head>
	<body>
      	<img src="/static/img/logo.jpg" class="logo">
	   	<div id="nav">
             <div id="verify">
                    <input type="number" name="" placeholder="请输入手机号" class="ipt1" oninput="if(value.length>4)value=value.slice(0,11)"/> 
                    <input type="password" name="password" placeholder="请输入密码" class="password" value="" /> 
                    <div class="yzm">
                          <input type="number" name="" placeholder="请输入验证码" class="ipt2" oninput="if(value.length>4)value=value.slice(0,4)"/>
                          <button class="btn">获取</button> 
                    </div>
                    <div id="images">
                    <img src="/static/img/yyy_03.png" class="msjq">
                    <span class="ljhk">立即注册</span>
                    </div>
             </div>  
	   	</div>
       	<div class="popup">
          <div class="popup-contnet">
            <div class="sys-cx clearfix">
              <div class="an fl">
                <a href="{$android}" target="_blank">
                  <i class="iconfont icon-anzhuo"></i>
                </a>
              </div>
              <div class="ios fl">
                <a href="{$ios}" target="_blank">
                  <i class="iconfont icon-ios"></i>
                </a>
              </div>
            </div>
          </div>
       	</div>
		<script type="text/javascript" src="/static/lib/jquery/1.9.1/jquery.min.js"></script> 
       	<script type="text/javascript">
                var ytel = GetQueryString("invite_code");
                var vcodeo=168354587545;
                function GetQueryString(name)
                {
                   var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
                   var r = window.location.search.substr(1).match(reg);
                   if(r!=null)return  unescape(r[2]); return null;
                }
                var disabled001 = true;
                var wait = 60;
                function time() {
                        if (wait == 0) {  //结束或错误重新开始
                            disabled001=true;            
                            wait = 60;  
                            $(".btn").attr('disabled',false);
                            $('.btn').text("重新发送")   
                        } else {  
                          $(".btn").attr('disabled',true);
                          $('.btn').text("已发送(" + wait + ")")
                            wait--;
                            setTimeout(function() {  
                                time(wait)  
                            },1000)  
                        }  
                }
       	        $('.btn').click(function(){
       	       	  if(!$('.ipt1').val()) return alert('手机号不能为空')
       	       	  if(!/^1[123456789]\d{9}$/.test($('.ipt1').val())) return alert('手机号格式不对');
                  var phone = $(".ipt1").val();
                  if(disabled001){
                    disabled001 = false;
                    time(wait)
                    $.ajax({
                          type: 'POST',
                          url: "http://www.kbb123.com/api/invite/sendSms",
                          data:{phone:phone},
                          success: function(response){
                            if(response.code==200){
                              vcodeo=response.data;
                            }else{
                              alert('出错！');
                            }
                          },
                          error: function(err){

                          }
                    })
                  }
       	        })

                $(".ljhk").click(function(){
                  var phone = $(".ipt1").val();
                  var password = $(".password").val();
                  var vcode = $(".ipt2").val();
                  if(vcode==vcodeo){
                    $.ajax({
                        type: 'POST',
                        url: "http://www.kbb123.com/api/invite/registering",
                        data: {phone:phone,password:password,vcode:vcode,ytel:ytel},
                        success: function(response){
                          if(response.code==501){
                            alert(response.msg)
                          }else if(response.code==502){
                            alert(response.msg)
                          }else if(response.code==503){
                            alert(response.msg)
                            $(".popup").fadeIn(300, function() {
                              $(this).addClass('on')
                            });
                          }else if(response.code==504){
                            alert(response.msg)
                            $(".popup").fadeIn(300, function() {
                              $(this).addClass('on')
                            });
                          }else if(response.code==200){
                            $(".popup").fadeIn(300, function() {
                              $(this).addClass('on')
                            });
                          }
                        },
                        error: function(err){

                        }
                    })  
                  }else{
                    alert('验证码错误');
                  }
                })
       	</script>           
	</body>
</html>